package net.monkeybros.sbus;

import com.neurospeech.wsclient.*;

import net.monkeybros.sbus.model.InfoCoord;
import net.monkeybros.sbus.model.InfoLinea;
import net.monkeybros.sbus.model.InfoNodo;
import net.monkeybros.sbus.model.InfoNodoMap;
import net.monkeybros.sbus.model.InfoRuta;
import net.monkeybros.sbus.model.InfoTipoNodo;

import org.w3c.dom.*;

public class Estructura extends SoapWebService{
	
	
	public Estructura(){
		this.setUrl("/services/estructura.asmx");
	}
	
	
	public String GetCommonLoadInstant() throws Exception 
	{
		SoapRequest req;
		req = buildSoapRequest("GetCommonLoadInstant","http://tempuri.org/","http://tempuri.org/GetCommonLoadInstant",null);
		Element request = req.method;
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		return WSHelper.getString(response,null,false);
	}
	
	public String GetCommonParadas(String linea) throws Exception 
	{
		SoapRequest req;
		req = buildSoapRequest("GetCommonParadas","http://tempuri.org/","http://tempuri.org/GetCommonParadas",null);
		Element request = req.method;
		addParameter(request, "linea",linea);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		return WSHelper.getString(response,null,false);
	}
	
	public java.util.Vector<InfoLinea> GetLineasFilter(Integer mask) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("GetLineasFilter","http://tempuri.org/","http://tempuri.org/GetLineasFilter",null);
		Element request = req.method;
		addParameter(request, "mask",mask);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoLinea> retVal = new java.util.Vector<InfoLinea>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoLinea.loadFrom(e));
		}
		return retVal;
	}
	
	public java.util.Vector<InfoCoord> GetPolylineaSublinea(String label_linea, Integer num_sublinea) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("GetPolylineaSublinea","http://tempuri.org/","http://tempuri.org/GetPolylineaSublinea",null);
		Element request = req.method;
		addParameter(request, "label_linea",label_linea);
		addParameter(request, "num_sublinea",num_sublinea);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoCoord> retVal = new java.util.Vector<InfoCoord>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoCoord.loadFrom(e));
		}
		return retVal;
	}
	
	public java.util.Vector<InfoLinea> GetLineas() throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("GetLineas","http://tempuri.org/","http://tempuri.org/GetLineas",null);
		Element request = req.method;
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoLinea> retVal = new java.util.Vector<InfoLinea>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoLinea.loadFrom(e));
		}
		return retVal;
	}
	
	public String GetStringConnexion() throws Exception 
	{
		SoapRequest req;
		req = buildSoapRequest("GetStringConnexion","http://tempuri.org/","http://tempuri.org/GetStringConnexion",null);
		Element request = req.method;
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		return WSHelper.getString(response,null,false);
	}
	
	public java.util.Vector<InfoNodo> SearchNode(String substring) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("SearchNode","http://tempuri.org/","http://tempuri.org/SearchNode",null);
		Element request = req.method;
		addParameter(request, "substring",substring);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoNodo> retVal = new java.util.Vector<InfoNodo>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoNodo.loadFrom(e));
		}
		return retVal;
	}
	
	public java.util.Vector<InfoCoord> GetTopoSublinea(String label, Integer sublinea) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("GetTopoSublinea","http://tempuri.org/","http://tempuri.org/GetTopoSublinea",null);
		Element request = req.method;
		addParameter(request, "label",label);
		addParameter(request, "sublinea",sublinea);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoCoord> retVal = new java.util.Vector<InfoCoord>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoCoord.loadFrom(e));
		}
		return retVal;
	}
	
	public java.util.Vector<InfoTipoNodo> GetTiposNodosMap() throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("GetTiposNodosMap","http://tempuri.org/","http://tempuri.org/GetTiposNodosMap",null);
		Element request = req.method;
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoTipoNodo> retVal = new java.util.Vector<InfoTipoNodo>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoTipoNodo.loadFrom(e));
		}
		return retVal;
	}
	
	public java.util.Vector<InfoNodoMap> GetNodosMapSublinea(String label, Integer sublinea) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("GetNodosMapSublinea","http://tempuri.org/","http://tempuri.org/GetNodosMapSublinea",null);
		Element request = req.method;
		addParameter(request, "label",label);
		addParameter(request, "sublinea",sublinea);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoNodoMap> retVal = new java.util.Vector<InfoNodoMap>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoNodoMap.loadFrom(e));
		}
		return retVal;
	}
	
	public java.util.Vector<InfoRuta> GetRutasSublinea(String label, Integer sublinea) throws Exception 
	{
		NodeList list;
		int i;
		SoapRequest req;
		req = buildSoapRequest("GetRutasSublinea","http://tempuri.org/","http://tempuri.org/GetRutasSublinea",null);
		Element request = req.method;
		addParameter(request, "label",label);
		addParameter(request, "sublinea",sublinea);
		SoapResponse sr = getSoapResponse(req);
		Element response = (Element)sr.body.getFirstChild().getFirstChild();
		java.util.Vector<InfoRuta> retVal = new java.util.Vector<InfoRuta>();
		list = response.getChildNodes();
		for(i=0;i<list.getLength();i++)
		{
			Element e = (Element)list.item(i);
			retVal.addElement(InfoRuta.loadFrom(e));
		}
		return retVal;
	}
	
	
	
	
}
